﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace ZhiAo.CommonLibrary
{
    public class DynamicParam
    {
        public static List<string> GetParam(string key)
        {
           return GetParam(key, "{","}");
        }

        public static List<string> GetParam(string key, string regStart, string regEnd)
        {
            //Regex reg = new Regex("{([^}]*?)}");

            Regex reg = new Regex(regStart + "([^}]*?)" + regEnd);

            List<string> list = new List<string>();

            MatchCollection result = reg.Matches(key);
            for (int i = 0; i < result.Count; i++)
            {
                list.Add(result[i].Value.Replace(regStart, "").Replace(regEnd, ""));
            }
            return list;
        }
    }
}
